package a04_字符串;

import java.util.Scanner;

/**
 * <p>
 * a05_右旋字符串复习6
 * </p>
 *
 * @author flyduck
 * @since 2025/4/22
 */
public class a05_右旋字符串复习6 {

    //2
    //abcdefg
    //gfedcba
    //fgabcde
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int k = scanner.nextInt();
        String s = scanner.next();

        char[] chars = s.toCharArray();
        reserve(chars, 0, chars.length-1);
        reserve(chars, 0,  k-1);
        reserve(chars, k,  chars.length-1);
        System.out.println(new String(chars));
    }

    private static void reserve(char[] chars,int leftIdx,int rightIdx){
        while (leftIdx < rightIdx){
            char temp = chars[leftIdx];
            chars[leftIdx] = chars[rightIdx];
            chars[rightIdx] = temp;
            leftIdx++;
            rightIdx--;
        }
    }
}
